Ravi Vishwakarma is a dedicated Software Developer with a passion for crafting efficient and innovative solutions. With a keen eye for detail and years of experience, he excels in developing robust software systems that meet client needs. His expertise spans across multiple programming languages and technologies, making him a valuable asset in any software development project.
ICSM Computer
10-Nov-2025Syntax
Example 1: 1D Array
Output:
This means the array has 4 elements in 1 dimension.
Example 2: 2D Array
Output:
This means there are 2 rows and 3 columns.
Example 3: 3D Array
Output:
This means there are 2 blocks, each containing a 2×2 matrix.
Example 4: Using
.reshape()to change shapeOutput:
Example 5: Get number of dimensions
Output:
Returns the number of dimensions.
Summary
arr.shape(3, 4)arr.ndim2arr.size12